Skip to content

feat(web): list archived sessions - #391

Open
testikun wants to merge 3 commits into
openpi-dev:mainfrom
testikun:codex/issue-347-archived-sessions
Open

feat(web): list archived sessions#391
testikun wants to merge 3 commits into
openpi-dev:mainfrom
testikun:codex/issue-347-archived-sessions

Conversation

@testikun

@testikun testikun commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Problem

The Web archive lifecycle tracked by #347 can hide Session entries, and #361 adds an unarchive mutation, but there is no bounded read API that can discover archived Sessions for an archive view.

Value

Archived conversations become recoverable through a stable, searchable projection without copying or rewriting canonical Pi Session data.

Approach

  • Reuse Pi SessionManager metadata and the existing archived-sessions.json set as the only sources of truth.
  • Add a read-only archived Session projection with a 50-item page cap, 5,000-record scan cap, and bounded normalized query.
  • Use opaque cursors bound to both the last Session identity and normalized query.
  • Return explicit invalid-query and stale-cursor receipts.
  • Report matching rows omitted by the page and source records not scanned by the hard bound.
  • Expose authenticated GET /api/sessions/archived.

This is distinct from #361 unarchive mutation work. It does not add deletion, fork, historical editing, or UI.

Validation

  • bun run check
  • bun run test: 1242 passed, 0 failed, 1 skipped; Vitest 30 passed
  • focused adapter and Web Host tests: 33 passed
  • git diff --check

Impact

  • User-visible behavior: authenticated API consumers can browse archived Session metadata; no UI changes.
  • Model-visible context/tools: none.
  • Runtime/lifecycle: read-only bounded indexing over Pi-owned Session metadata.
  • Persisted config/data: none.
  • Compatibility/risk: additive endpoint and adapter method; stale cursors fail closed rather than silently skipping entries.

Related to #347.

@testikun

testikun commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

CI context: both Linux Node jobs reach the pre-existing packed standalone Web CLI smoke, install the tarball, and then the server exits before announcing its origin (kill: No such process). Windows and the other checks pass. This matches the independently reproduced fresh-install peer-dependency failure tracked in #328, where npm selects Pi 0.85.0 and @earendil-works/pi-server cannot be resolved. Evidence: #328 (comment)

This PR does not change package metadata, CLI startup, or peer-dependency resolution. Its local check, focused tests, full Node suite, and Vitest suite pass as recorded in the PR body.

@testikun
testikun force-pushed the codex/issue-347-archived-sessions branch from ce94c25 to 83e76ac Compare September 6, 2026 06:19

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The archived-history API has useful value, but two P2 pagination failures were reproduced using real Pi Session files on this exact head. Please address the inline findings and add regression tests before merge. No implementation changes were made during review. Existing focused tests pass 41/41; they do not cover these cases.

Comment thread web/adapter/pi-adapter.ts Outdated
Comment thread web/adapter/pi-adapter.ts
@testikun

testikun commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Fixed and pushed as ee70b28 (merged latest main).

  • Archived cursors now bind to the exact Session file path instead of only the Session ID, so copied/duplicate IDs paginate without looping.
  • Cursor query state uses a bounded SHA-256 fingerprint of the normalized NFKC query, keeping generated cursors replayable under the 512-byte limit.
  • Added duplicate-ID, long CJK, and NFKC-expanding query regressions.
  • Validation: Node 24 archived adapter regression passed; bun run check passed after formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants